package january.test_1_22;

import java.util.Arrays;
import java.util.Scanner;

public class TestMain {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] arr = new int[3*n];
        for(int i = 0 ; i < 3*n ; i++) {
            arr[i] = scanner.nextInt();
        }
        Arrays.sort(arr);
        int m = found(arr);
        int left = 0;
        int right = 3*n - 1;
        int max = 0;
        while(left < right) {
            int tmp = arr[left] + arr[right] + arr[right - 1];
            if(left < m && right - 1 >= m) {
                if(tmp%3 == 0) {
                    max += tmp / 3;
                } else {
                    max = max + tmp / 3 + 1;
                }
            } else if(left >= m && right - 1 >= m) {
                if(tmp%3 == 0) {
                    max += tmp / 3;
                } else {
                    max = max + tmp / 3 + 1;
                }
            } else {
                max += tmp/3;
            }
            left++;
            right-=2;
        }
        System.out.println(max);
    }
    public static int found(int[] arr) {
        for(int i = 0; i < arr.length; i++) {
            if(arr[i] > 2) {
                return i;
            }
        }
        return arr.length - 1;
    }
}
